import { request } from '@umijs/max';

// 获取订单列表
export async function getOrderList(params: API.OrderAdminParams) {
  return request<API.QueryResult>('/orders', {
    method: 'GET',
    params,
    headers: {
      token: localStorage.getItem('token') || '',
    },
  });
}

// 配货
export async function configOrder(ids: any[]) {
  return request('/orders/checkDone', {
    method: 'put',
    data: {
      ids,
    },
    headers: {
      token: localStorage.getItem('token') || '',
    },
  });
}

// 配货
export async function sendOrder(ids: any[]) {
  return request('/orders/checkOut', {
    method: 'put',
    data: {
      ids,
    },
    headers: {
      token: localStorage.getItem('token') || '',
    },
  });
}

export async function closeOrder(ids: any[]) {
  return request('/orders/close', {
    method: 'put',
    data: {
      ids,
    },
    headers: {
      token: localStorage.getItem('token') || '',
    },
  });
}

// 订单详情
export async function getOrderDetail(id: string) {
  return request('/orders/' + id, {
    method: 'GET',
    headers: {
      token: localStorage.getItem('token') || '',
    },
  });
}
